//
//  xxxTableViewCell.m
//  shuilijuOASystem
//
//  Created by michael on 16/8/9.
//  Copyright © 2016年 czd. All rights reserved.
//

#import "xxxTableViewCell.h"

@implementation xxxTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
 self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
 if (self) {
          self.selectionStyle = UITableViewCellSelectionStyleNone;

   _label = [[UILabel alloc]initWithFrame:CGRectZero];
    _label.font = [UIFont systemFontOfSize:13];
    
    [self.contentView addSubview:_label];
    _label1 = [[UILabel alloc]init];
    _label1.frame = CGRectZero;
           _label1.numberOfLines = 0;
      [_label1 setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label1];
        _label2 = [[UILabel alloc]init];
    _label2.frame = CGRectZero;
           _label2.numberOfLines = 0;
      [_label2 setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label2];

}

    return self;

}


- (void)layoutSubviews
{
[super layoutSubviews];
  CGFloat  titlesize1  = [OAToolBox sizebyText:_sub.morning font:13 minsWidth:20];
    CGFloat  titlesize2  = [OAToolBox sizebyText:_sub.afternoon font:13 minsWidth:20];
    CGFloat  titlesize = titlesize2 +titlesize1;
    
// _label1.backgroundColor = [UIColor yellowColor];
  _label.frame = CGRectMake(20, 0, 100, 30);

 if(titlesize>60){
_label1.frame = CGRectMake(10, _label.bottom, KScreenWidth-20,titlesize1);
_label2.frame = CGRectMake(10, _label1.bottom, KScreenWidth-20,titlesize2);

 }
 else{
_label1.frame = CGRectMake(10, _label.bottom, KScreenWidth-20,30);
_label2.frame = CGRectMake(10, _label1.bottom, KScreenWidth-20,30);

 
 }
 _label1.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"buddy_header_bg"]];
  _label2.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"buddy_header_bg"]];

    _label.text = [NSString stringWithFormat:@"%@ ",_sub.value];
    _label1.text = [NSString stringWithFormat:@"上午:%@",_sub.morning];
    _label2.text = [NSString stringWithFormat:@"下午:%@",_sub.afternoon];


}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
